package com.etc.traval.bizimpl;

import java.util.List;

import com.etc.traval.biz.RoomBiz;
import com.etc.traval.dao.RoomDao;
import com.etc.traval.daoimpl.RoomDaoImpl;
import com.etc.travel.entity.Room;
import com.etc.travel.entity.Seller;

public class RoomBizImpl implements RoomBiz {
	RoomDao rdao = new RoomDaoImpl();

	@Override
	public Room queryRoom(int id) {
		if (id < 10000) {
			return null;
		}
		return rdao.queryRoom(id);
	}

	@Override
	public boolean addRoom(Room room) {
		if (room == null || room.getRoom_seller() == null | room.getRoom_type() == null
				|| "".equals(room.getRoom_type())) {
			return false;
		}
		if (room.getRoom_logo() == null || "".equals(room.getRoom_logo()) || room.getRoom_money() <= 0) {
			return false;
		}
		return rdao.addRoom(room);
	}

	@Override
	public boolean delRoom(int id) {
		if (id < 10000) {
			return false;
		}
		return rdao.delRoom(id);
	}

	@Override
	public List<Room> queryRoomBySeller(Seller seller) {
		if (seller.getSeller_id() < 10000) {
			return null;
		}
		return rdao.queryRoomBySeller(seller);
	}

	@Override
	public boolean updateRoomById(String system, int id) {
		return rdao.updateRoomById(system, id);
	}

	@Override
	public List<Room> queryBySellerTypeSystem(Seller seller, String type, String system) {
		// TODO Auto-generated method stub
		return rdao.queryBySellerTypeSystem(seller, type, system);
	}

	@Override
	public List<Room> queryAll(Seller seller) {
		// TODO Auto-generated method stub
		return rdao.queryAll(seller);
	}

}
